﻿// test.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <windows.h>
#include "boss.h"
#include "resource.h"
#include <commctrl.h>
#pragma comment(lib,"comctl32.lib")
#include "aobscan/aobscan.h"
#include <iostream>
#include "../common/Base64.h"
#include "../common/AES_Encrypt.h"
//typedef unsigned char   uint8;
//#define _BYTE  uint8
//#define _WORD  uint16
//#define LOBYTE(w)           ((BYTE)(((DWORD_PTR)(w)) & 0xff))
//#define HIBYTE(w)           ((BYTE)((((DWORD_PTR)(w)) >> 8) & 0xff))
//#define BYTEn(x, n)   (*((_BYTE*)&(x)+n))
//#define WORDn(x, n)   (*((_WORD*)&(x)+n))
//#define BYTE0(x)   BYTEn(x,  0)         // byte 0 (counting from 0)  添加此宏定义
//#define BYTE1(x)   BYTEn(x,  1)         // byte 1 (counting from 0)
//#define BYTE2(x)   BYTEn(x,  2)
//#define BYTE3(x)   BYTEn(x,  3)
//#define BYTE4(x)   BYTEn(x,  4)
//typedef unsigned long DWORD_PTR;


//#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
INT_PTR CALLBACK DialogProc(_In_ HWND   hwndDlg, _In_ UINT   uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam);

VOID CALLBACK myTimerProc1(
	HWND hwnd, // handle of window for timer messages
	UINT uMsg, // WM_TIMER message
	UINT idEvent, // timer identifier
	DWORD dwTime // current system time
) 
{
	Manager::Get()->OnTimer();
}

void CenterText(HDC hDC, int x, int y, LPCTSTR szFace, LPCTSTR szMessage, int point)
{
	HFONT hFont = CreateFont(-point * GetDeviceCaps(hDC, LOGPIXELSY) / 72,
		0, 0, 0, FW_BOLD, TRUE, FALSE, FALSE,
		ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
		PROOF_QUALITY, VARIABLE_PITCH, szFace);
	//  assert(hFont);

	HGDIOBJ hOld = SelectObject(hDC, hFont);

	SetTextAlign(hDC, TA_CENTER | TA_BASELINE);

	SetBkMode(hDC, TRANSPARENT);
	SetTextColor(hDC, RGB(0, 0, 0xFF));
	TextOut(hDC, x, y, szMessage, _tcslen(szMessage));

	SelectObject(hDC, hOld);
	DeleteObject(hFont);
}
time_t FTimeToTimeT(FILETIME time)
{
	ULARGE_INTEGER ui;
	ui.LowPart = time.dwLowDateTime;
	ui.HighPart = time.dwHighDateTime;
	time_t tt1 = ((LONGLONG)(ui.QuadPart - 116444736000000000) / 10000000)/* - 28800*/; //加了这个时间就差8小时了
	return tt1;
}

const TCHAR szMessage[] = _T("Hello, World");
const TCHAR szFace[] = _T("Times New Roman");
#include <time.h>

void GetBuf(char *msginfo) {
	static time_t starttime = time(NULL);
	static std::map<std::string, int> users;
	std::string buf = msginfo;
	if (buf.find("IMAGE1902700036") != std::string::npos)
	{
		std::string name;
		std::string buf2;
		int gold;
		int ipos1 = buf.find("【");
		if (ipos1 != std::string::npos)
		{
			int ipos2 = buf.find("】", ipos1);
			name = buf.substr(ipos1 + 2, ipos2 - ipos1 - 2);

			ipos1 = buf.find("【", ipos2);
			if (ipos1 != std::string::npos)
			{
				ipos2 = buf.find("金币】", ipos1);
				buf2 = buf.substr(ipos1 + 2, ipos2 - ipos1 - 2);
				gold = atoi(buf2.c_str());
				if (gold > 0)
				{
					auto item = users.find(name);
					if (item != users.end())
					{
						item->second += gold;
						char buff[MAX_PATH] = "";
						time_t nowtime = time(NULL);
						int st = nowtime - starttime;
						sprintf_s(buff, MAX_PATH, "%s 共回收金币 %d,共用时 %d秒", name.c_str(), item->second, st);
						OutputDebugStringA(buff);
					}
					else
					{
						//加新的
						users.insert(std::pair<std::string, int>(name, gold));
					}
				}
			}
		}


	}
}


int sub_6465B0(int keylen, char* key, char* input, int a4)
{
	int v5; // ecx
	int v7; // eax
	int result; // eax
	int v9 = 0; // esi
	int v10; // edx
	int v11; // esi
	int v12; // edi
	int i; // edx
	int v14; // ecx
	int v17[513]; // [esp+14h] [ebp-808h]

	char* output = input;
	memset(v17,0, 513 * sizeof(int));
	v17[0] = (int)(int*)key;
	v5 = 2;
	//v16[0] = (int)(int*)input;
	int index = 257;
	for (size_t i = 0; i < 256; i++)
	{
		v17[index] = i;
		index++;
	}
	i = 0;
	do
	{
		v17[i + 1] = *((v5 - 2) % keylen + key);
		v17[i + 2] = *((v5 - 1) % keylen + key);
		v17[i + 3] = *(v5 % keylen + key);
		v7 = v5 + 1;
		v17[i + 4] = *(unsigned __int8*)(v7 % keylen + key);
		v5 += 4;
		i += 4;

	} while (v5 - 2 < 0x100);
	result = 0;
	v9 = 0;
	do
	{
		v10 = *(int*)((char*)&v17[257] + result);
		v9 = (unsigned __int8)(v9 + v10 + *(int*)((char*)&v17[1] + result));
		*(int*)((char*)&v17[257] + result) = v17[v9 + 257];
		result += 4;
		v17[v9 + 257] = v10;
	} while (result < 0x400);
	//LOBYTE(v11) = 0;
	//LOBYTE(v12) = 0;
	v11 = 0;
	v12 = 0;
	for (i = 0; i < a4; ++i)
	{
		v11 = (unsigned __int8)(v11 + 1);
		v14 = v17[v11 + 257];
		v12 = (unsigned __int8)(v14 + v12);
		v17[v11 + 257] = v17[v12 + 257];
		v17[v12 + 257] = v14;
		result = (unsigned __int8)(v14 + v17[v11 + 257]);
		result = v17[(unsigned __int8)result + 257];
		*(BYTE*)(output + i) ^= result;
	}
	return result;
}
std::string& replace_all(std::string& str, const std::string& old_value, const std::string& new_value)
{
	while (true) {
		std::string::size_type pos(0);
		if ((pos = str.find(old_value)) != std::string::npos)
			str.replace(pos, old_value.length(), new_value);
		else break;
	}
	return str;
}
std::string& replace_all_distinct(std::string& str, const std::string& old_value, const std::string& new_value)
{
	for (std::string::size_type pos(0); pos != std::string::npos; pos += new_value.length()) {
		if ((pos = str.find(old_value, pos)) != std::string::npos)
			str.replace(pos, old_value.length(), new_value);
		else break;
	}
	return str;
}
#include<fstream>





/*
* ST LUA文件解密
* 00645BE0 | 55                   | push ebp                                   | 
00645BE1 | 8BEC                 | mov ebp,esp                                | 
00645BE3 | 6A FF                | push FFFFFFFF                              | 
00645BE5 | 68 9A99C600          | push game.C6999A                           | 
00645BEA | 64:A1 00000000       | mov eax,dword ptr fs:[0]                   | 
00645BF0 | 50                   | push eax                                   | 
00645BF1 | 81EC B4000000        | sub esp,B4                                 | 
00645BF7 | A1 E489F500          | mov eax,dword ptr ds:[F589E4]              | 
00645BFC | 33C5                 | xor eax,ebp                                | 
00645BFE | 8945 F0              | mov dword ptr ss:[ebp-10],eax              | 
00645C01 | 53                   | push ebx                                   | 
00645C02 | 56                   | push esi                                   | 
00645C03 | 57                   | push edi                                   | 
00645C04 | 50                   | push eax                                   | 
00645C05 | 8D45 F4              | lea eax,dword ptr ss:[ebp-C]               | 
00645C08 | 64:A3 00000000       | mov dword ptr fs:[0],eax                   | 
00645C0E | C745 FC 00000000     | mov dword ptr ss:[ebp-4],0                 | 
00645C15 | 8D8D 78FFFFFF        | lea ecx,dword ptr ss:[ebp-88]              | 
00645C1B | 8B5D 08              | mov ebx,dword ptr ss:[ebp+8]               | 
00645C1E | 8B75 0C              | mov esi,dword ptr ss:[ebp+C]               | 
00645C21 | 899D 40FFFFFF        | mov dword ptr ss:[ebp-C0],ebx              | 
00645C27 | C785 5CFFFFFF 000000 | mov dword ptr ss:[ebp-A4],0                | 
00645C31 | 6A 09                | push 9                                     | 
00645C33 | C745 88 00000000     | mov dword ptr ss:[ebp-78],0                | 
00645C3A | C745 8C 00000000     | mov dword ptr ss:[ebp-74],0                | 
00645C41 | 68 D079E500          | push game.E579D0                           | E579D0:"--ENBEG--"
00645C46 | 89B5 48FFFFFF        | mov dword ptr ss:[ebp-B8],esi              | 
00645C4C | C745 88 00000000     | mov dword ptr ss:[ebp-78],0                | 
00645C53 | C745 8C 0F000000     | mov dword ptr ss:[ebp-74],F                | 
00645C5A | C685 78FFFFFF 00     | mov byte ptr ss:[ebp-88],0                 | 
00645C61 | E8 AA02E4FF          | call game.485F10                           | 
00645C66 | C745 FC 01000000     | mov dword ptr ss:[ebp-4],1                 | 
00645C6D | 8D8D 60FFFFFF        | lea ecx,dword ptr ss:[ebp-A0]              | 
00645C73 | 6A 09                | push 9                                     | 
00645C75 | C785 70FFFFFF 000000 | mov dword ptr ss:[ebp-90],0                | 
00645C7F | C785 74FFFFFF 000000 | mov dword ptr ss:[ebp-8C],0                | 
00645C89 | 68 E879E500          | push game.E579E8                           | E579E8:"--ENEND--"
00645C8E | C785 70FFFFFF 000000 | mov dword ptr ss:[ebp-90],0                | 
00645C98 | C785 74FFFFFF 0F0000 | mov dword ptr ss:[ebp-8C],F                | 
00645CA2 | C685 60FFFFFF 00     | mov byte ptr ss:[ebp-A0],0                 | 
00645CA9 | E8 6202E4FF          | call game.485F10                           | 
00645CAE | C645 FC 02           | mov byte ptr ss:[ebp-4],2                  | 
00645CB2 | 8D4D A8              | lea ecx,dword ptr ss:[ebp-58]              | 
00645CB5 | 6A 09                | push 9                                     | 
00645CB7 | C745 B8 00000000     | mov dword ptr ss:[ebp-48],0                | 
00645CBE | C745 BC 00000000     | mov dword ptr ss:[ebp-44],0                | 
00645CC5 | 68 DC79E500          | push game.E579DC                           | E579DC:"--DEBEG--"
00645CCA | C745 B8 00000000     | mov dword ptr ss:[ebp-48],0                | 
00645CD1 | C745 BC 0F000000     | mov dword ptr ss:[ebp-44],F                | 
00645CD8 | C645 A8 00           | mov byte ptr ss:[ebp-58],0                 | 
00645CDC | E8 2F02E4FF          | call game.485F10                           | 
00645CE1 | C645 FC 03           | mov byte ptr ss:[ebp-4],3                  | 
00645CE5 | 8D4D 90              | lea ecx,dword ptr ss:[ebp-70]              | 
00645CE8 | 6A 09                | push 9                                     | 
00645CEA | C745 A0 00000000     | mov dword ptr ss:[ebp-60],0                | 
00645CF1 | C745 A4 00000000     | mov dword ptr ss:[ebp-5C],0                | 
00645CF8 | 68 FC79E500          | push game.E579FC                           | E579FC:"--DEEND--"
00645CFD | C745 A0 00000000     | mov dword ptr ss:[ebp-60],0                | 
00645D04 | C745 A4 0F000000     | mov dword ptr ss:[ebp-5C],F                | 
00645D0B | C645 90 00           | mov byte ptr ss:[ebp-70],0                 | 
00645D0F | E8 FC01E4FF          | call game.485F10                           | 
00645D14 | C645 FC 04           | mov byte ptr ss:[ebp-4],4                  | 
00645D18 | C743 10 00000000     | mov dword ptr ds:[ebx+10],0                | 
00645D1F | C743 14 0F000000     | mov dword ptr ds:[ebx+14],F                | 
00645D26 | C603 00              | mov byte ptr ds:[ebx],0                    | 
00645D29 | 33C9                 | xor ecx,ecx                                | 
00645D2B | C785 5CFFFFFF 010000 | mov dword ptr ss:[ebp-A4],1                | 
00645D35 | 898D 58FFFFFF        | mov dword ptr ss:[ebp-A8],ecx              | 
00645D3B | 837D BC 10           | cmp dword ptr ss:[ebp-44],10               | 
00645D3F | 8D45 A8              | lea eax,dword ptr ss:[ebp-58]              | 
00645D42 | 8B55 A8              | mov edx,dword ptr ss:[ebp-58]              | 
00645D45 | 8B7E 14              | mov edi,dword ptr ds:[esi+14]              | 
00645D48 | 0F43C2               | cmovae eax,edx                             | 
00645D4B | 8B56 10              | mov edx,dword ptr ds:[esi+10]              | 
00645D4E | 8995 50FFFFFF        | mov dword ptr ss:[ebp-B0],edx              | 
00645D54 | 89B5 54FFFFFF        | mov dword ptr ss:[ebp-AC],esi              | 
00645D5A | 83FF 10              | cmp edi,10                                 | 
00645D5D | 72 0E                | jb game.645D6D                             | 
00645D5F | 8B0E                 | mov ecx,dword ptr ds:[esi]                 | 
00645D61 | 898D 54FFFFFF        | mov dword ptr ss:[ebp-AC],ecx              | 
00645D67 | 8B8D 58FFFFFF        | mov ecx,dword ptr ss:[ebp-A8]              | 
00645D6D | FF75 B8              | push dword ptr ss:[ebp-48]                 | 
00645D70 | 50                   | push eax                                   | 
00645D71 | 51                   | push ecx                                   | 
00645D72 | 52                   | push edx                                   | 
00645D73 | FFB5 54FFFFFF        | push dword ptr ss:[ebp-AC]                 | 
00645D79 | E8 A218E4FF          | call game.487620                           | 
00645D7E | 8BC8                 | mov ecx,eax                                | 
00645D80 | 83C4 14              | add esp,14                                 | 
00645D83 | 898D 54FFFFFF        | mov dword ptr ss:[ebp-AC],ecx              | 
00645D89 | 83F9 FF              | cmp ecx,FFFFFFFF                           | 
00645D8C | 0F84 42020000        | je game.645FD4                             | 
00645D92 | 837D A4 10           | cmp dword ptr ss:[ebp-5C],10               | 
00645D96 | 8D45 90              | lea eax,dword ptr ss:[ebp-70]              | 
00645D99 | 8BD6                 | mov edx,esi                                | 
00645D9B | 0F4345 90            | cmovae eax,dword ptr ss:[ebp-70]           | 
00645D9F | 83FF 10              | cmp edi,10                                 | 
00645DA2 | 72 02                | jb game.645DA6                             | 
00645DA4 | 8B16                 | mov edx,dword ptr ds:[esi]                 | 
00645DA6 | FF75 A0              | push dword ptr ss:[ebp-60]                 | 
00645DA9 | 034D B8              | add ecx,dword ptr ss:[ebp-48]              | 
00645DAC | 50                   | push eax                                   | 
00645DAD | 51                   | push ecx                                   | 


00645E6C | 6A 04                | push 4                                     |
00645E6E | C741 10 00000000     | mov dword ptr ds:[ecx+10],0                |
00645E75 | C741 14 0F000000     | mov dword ptr ds:[ecx+14],F                |
00645E7C | 68 F479E500          | push game.E579F4                           | E579F4:"\r\n\t "
00645E81 | C601 00              | mov byte ptr ds:[ecx],0                    |
00645E84 | E8 8700E4FF          | call game.485F10                           |
00645E89 | C645 FC 06           | mov byte ptr ss:[ebp-4],6                  |
00645E8D | 8D45 D8              | lea eax,dword ptr ss:[ebp-28]              |
00645E90 | 50                   | push eax                                   |
00645E91 | C645 FC 05           | mov byte ptr ss:[ebp-4],5                  |
00645E95 | E8 A651E4FF          | call game.48B040                           |
00645E9A | C645 FC 07           | mov byte ptr ss:[ebp-4],7                  |
00645E9E | 8D55 D8              | lea edx,dword ptr ss:[ebp-28]              |
00645EA1 | 837D EC 10           | cmp dword ptr ss:[ebp-14],10               |
00645EA5 | 8D4D C0              | lea ecx,dword ptr ss:[ebp-40]              |
00645EA8 | FF75 E8              | push dword ptr ss:[ebp-18]                 |
00645EAB | 0F4355 D8            | cmovae edx,dword ptr ss:[ebp-28]           |
00645EAF | E8 1C040000          | call game.6462D0                           | decode
00645EB4 | 838D 5CFFFFFF 04     | or dword ptr ss:[ebp-A4],4                 |
00645EBB | 83C4 20              | add esp,20                                 |
00645EBE | 8378 14 10           | cmp dword ptr ds:[eax+14],10               |
00645EC2 | 8B48 10              | mov ecx,dword ptr ds:[eax+10]              |
00645EC5 | 72 02                | jb game.645EC9                             |
00645EC7 | 8B00                 | mov eax,dword ptr ds:[eax]                 |
*/

void DeCodeSTLuaFile() {

	std::string str;
	std::ifstream fout;
	fout.open("D:\\神途\\extra\\1540501\\GUILayout\\NPCShop.lua");
	fout.seekg(0, std::ios::end);//文件指针指向结尾
	int length = fout.tellg();//获取文件长度
	fout.seekg(0, std::ios::beg);//文件指针从新指向开头
	char* buffer = new char[length];
	fout.read(buffer, length);//读取
	fout.close();
	str = buffer;
	delete[] buffer;
	//从--DEBEG--开始   到 DATA: 或者  --DEEND--结束
	std::string::size_type pos = str.find("--DEBEG--");
	std::string::size_type pos2 = str.find("--DEEND--");
	std::string::size_type pos3 = str.find(" DATA:");
	//取中间的字符串
	std::string::size_type ppos;
	if (pos2 != std::string::npos)
	{
		ppos = pos2;
	}
	if (pos3 != std::string::npos)
	{
		ppos = pos3;
	}
	std::string str2 = str.substr(pos + 9, ppos - (pos + 9));
	unsigned char* encrypted_data = new unsigned char[str2.length()]();
	str = replace_all(str2, "\n", "");

	auto len = _AES::Base64Decode(str.c_str(), encrypted_data);
	//base64 decode出来的结果 0x3位为xor密码 0x5-0x25位为密文 解出来结果给下面做KEY
	byte xorkey = encrypted_data[0x3];

	int xorkeylen = encrypted_data[0x4] ^ xorkey;
	byte* encrypted_data2 = new byte[xorkeylen]();
	memcpy(encrypted_data2, encrypted_data + 0x5, xorkeylen);
	//解密
	for (size_t i = 0; i < xorkeylen; i++)
	{
		encrypted_data2[i] ^= xorkey;
	}

	std::string key((char*)encrypted_data2, xorkeylen);




	/*
00646457 | 8B740E 07            | mov esi,dword ptr ds:[esi+ecx+7 |
0064645B | 83C1 0B              | add ecx,B                       |
0064645E | 03C1                 | add eax,ecx                     |
00646460 | C745 E8 00000000     | mov dword ptr ss:[ebp-18],0     |
00646467 | 56                   | push esi                        |
00646468 | 50                   | push eax                        |
00646469 | 8D4D D8              | lea ecx,dword ptr ss:[ebp-28]   |
0064646C | C745 EC 0F000000     | mov dword ptr ss:[ebp-14],F     |
00646473 | C645 D8 00           | mov byte ptr ss:[ebp-28],0      |
00646477 | E8 94FAE3FF          | call game.485F10                | base64
0064647C | C645 FC 03           | mov byte ptr ss:[ebp-4],3       |
00646480 | 8D45 D8              | lea eax,dword ptr ss:[ebp-28]   |
00646483 | 837D EC 10           | cmp dword ptr ss:[ebp-14],10    |
00646487 | 8D4D C0              | lea ecx,dword ptr ss:[ebp-40]   |
0064648A | 8B55 9C              | mov edx,dword ptr ss:[ebp-64]   |
0064648D | 0F4345 D8            | cmovae eax,dword ptr ss:[ebp-28 |
00646491 | 837D D4 10           | cmp dword ptr ss:[ebp-2C],10    |
00646495 | 56                   | push esi                        |
00646496 | 0F434D C0            | cmovae ecx,dword ptr ss:[ebp-40 |
0064649A | 50                   | push eax                        |
0064649B | E8 10010000          | call game.6465B0                | zhe li decode
006464A0 | 0F1045 D8            | movups xmm0,xmmword ptr ss:[ebp |
006464A4 | C747 10 00000000     | mov dword ptr ds:[edi+10],0     |
006464AB | 83C4 08              | add esp,8                       |
006464AE | C747 14 00000000     | mov dword ptr ds:[edi+14],0     |
	*/
	int slen = *(int*)((BYTE*)encrypted_data + xorkeylen + 0x7);
	char* input = (char*)encrypted_data + 0xB + xorkeylen;
	sub_6465B0(xorkeylen, (char*)key.c_str(), (char*)input, slen);
	std::ofstream ofs;
	ofs.open("D:\\work\\code\\dm\\LuaApi\\Bin\\test.lua", std::ios::out | std::ios_base::trunc);
	ofs << input << std::endl;
	ofs.close();
}

int WINAPI WinMain(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR lpCmdLine,
	int nCmdShow
)
{
	HWND _hWnd = (HWND)0x3017A;

	SendMessageA((HWND)_hWnd, WM_MOUSEMOVE, 0, MAKELPARAM(1024 / 2, 768 / 2));
	SendMessageA((HWND)_hWnd, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(1024 / 2, 768 / 2));
	Sleep(100);
	SendMessageA((HWND)_hWnd, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(1024 / 2, 768 / 2));
	Sleep(100);
	SendMessageA((HWND)_hWnd, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(1024 / 2, 768 / 2));
	Sleep(100);
	SendMessageA((HWND)_hWnd, WM_RBUTTONUP, 0, MAKELPARAM(1024 / 2, 768 / 2));
	
	return 1;

}

INT_PTR CALLBACK DialogProc(_In_ HWND   hwndDlg, _In_ UINT   uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
{
	static int iVscrollPos,  y,ipos;
	switch (uMsg)
	{
	case WM_INITDIALOG:
	{ 
		RECT rcClient;  // Client area of parent window 

		//创建窗口等待成功的消息
		Manager::Get()->CreateHwnd(hwndDlg,10,10);
	}
		break;
	case WM_CLOSE:
		exit(0);
		break;
	case WM_COMMAND:
		switch (wParam)
		{
		case IDC_BUTTON1:
		{
			Manager::Get()->TestProces(1);
		}
			
			break;
		default:
			break;
		}
		break;
	case WM_MOUSEHWHEEL:
	{
		int zDelta = (short)HIWORD(wParam);
	}
		

	case WM_VSCROLL:
	{
		ipos = 0;
		switch (LOWORD(wParam))
		{
		case SB_LINEDOWN:
			iVscrollPos += 1;
			ipos = -10;
			break;
		case SB_LINEUP:
			iVscrollPos -= 1;
			ipos = 10;
			break;
		case SB_THUMBTRACK:
			ipos = HIWORD(wParam) - iVscrollPos;
			std::string ii = std::to_string(ipos);
			//OutputDebugStringA(ii.c_str());
			ipos = -11 * (ipos);
			iVscrollPos = HIWORD(wParam);
			break;
		}
		//iVscrollPos = min(50 - y, max(0, iVscrollPos));  //确保滑块不超出滚动条的范围
		
		if (iVscrollPos != GetScrollPos(hwndDlg, SB_VERT))
		{

			SetScrollPos(hwndDlg, SB_VERT, iVscrollPos, TRUE); // 设置滚动条的位置
			ScrollWindow(hwndDlg, 0, ipos, NULL, NULL);

			UpdateWindow(hwndDlg);

			//InvalidateRect(hwndDlg, NULL, TRUE);   //发送WM_PAINT消息，更新窗口
		}
	}
		break;
	case WM_TIMER:
	{
		
	}
		break;
	case WM_COPYDATA:
	{
		PCOPYDATASTRUCT  pMyCDS = (PCOPYDATASTRUCT)lParam;
		Manager::Get()->OnBossDead((char*)pMyCDS->lpData); 
	}
		
		break;
	default:
		break;
	}
	return FALSE;
}




